//package com.aniu.smslisten.receiver;
//
//import android.content.Intent;
//import android.util.Log;
//
//import androidx.annotation.NonNull;
//
//import com.aniu.smslisten.service.SmsListenService;
//import com.aniu.smslisten.util.LogToFile;
//import com.google.firebase.messaging.FirebaseMessagingService;
//import com.google.firebase.messaging.RemoteMessage;
//
//public class CustomFirebaseMessagingService extends FirebaseMessagingService {
//    private static final String TAG = "CustomFirebaseMessagingService";
//
//    @Override
//    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
//        super.onMessageReceived(remoteMessage);
//        LogToFile.log(this, TAG, "Firebase message received");
//
//        // 判断SmsListenService是否正在运行
//        if (!SmsListenService.isServiceRunning(this)) {
//            LogToFile.log(this, TAG, "SmsListenService is not running, restarting...");
//            Intent serviceIntent = new Intent(this, SmsListenService.class);
//            startForegroundService(serviceIntent);
//        }
//
//    }
//
//    @Override
//    public void onNewToken(@NonNull String token) {
//        super.onNewToken(token);
//        LogToFile.log(this, TAG, "Refreshed token: " + token);
//        // 将新Token发送到服务器或其他处理逻辑
//        sendTokenToServer(token);
//    }
//
//    private void sendTokenToServer(String token) {
//        // 实现将Token发送到服务器的逻辑
//        Log.d(TAG, "Token sent to server: " + token);
//    }
//
//}
